<template>
  <div>
    <el-card>
      <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
      <div id="moneyPlan"
           style="width: 600px;height:400px;"></div>
    </el-card>
  </div>
</template>
<script>
import * as echarts from 'echarts'

export default {
  data () {
    return {

    }

  },
  methods: {

  },
  created () {

  },
  mounted () {
    // 基于准备好的dom，初始化echarts实例
    var chartDom = document.getElementById('moneyPlan');
    var myChart = echarts.init(chartDom);

    // 指定图表的配置项和数据
    var option;

    option = {
      title: {
        text: '计划消费统计'
      },
      legend: {
        data: ['预算分配（Allocated Budget）', '实际开销（Actual Spending）']
      },
      radar: {
        // shape: 'circle',
        indicator: [
          { name: '保养', max: 6500 },
          { name: '维修', max: 16000 },
          { name: '员工工资', max: 30000 },
          { name: '绿化', max: 38000 },
          { name: '保洁', max: 52000 },
          { name: '巡检', max: 25000 }
        ]
      },
      series: [{
        name: '预算 vs 开销（Budget vs spending）',
        type: 'radar',
        data: [
          {
            value: [4200, 3000, 20000, 35000, 50000, 18000],
            name: '预算分配（Allocated Budget）'
          },
          {
            value: [5000, 14000, 28000, 26000, 42000, 21000],
            name: '实际开销（Actual Spending）'
          }
        ]
      }]
    };


    // 使用刚指定的配置项和数据显示图表。
    option && myChart.setOption(option);
  }
}
</script>
